package com.tencent.wxcloudrun.service.impl;

import com.tencent.wxcloudrun.dto.Shippingcarsku;
import com.tencent.wxcloudrun.dto.Sku;
import com.tencent.wxcloudrun.mapper.ShippingcarskuMapper;
import com.tencent.wxcloudrun.service.ShippingcarskuService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lichongbing
 * @version 1.0.0
 * @createdate 2023/3/15 21:08
 * @description: TODO
 */
@Service
public class ShippingcarskuServiceImpl implements ShippingcarskuService {
    @Autowired
    private ShippingcarskuMapper shippingcarskuMapper;
    @Override
    public int addShippingCarSku(List<Sku> sku, String shippingcarid) {
       int k=0;
        for (int i = 0; i < sku.size(); i++) {
             k=i;
            shippingcarskuMapper.addShippingCarSku(sku.get(i).getOptionId(), sku.get(i).getOptionValueId(),shippingcarid);
        }
        return k;
    }

    @Override
    public List<Shippingcarsku> getShippingcarsku(Integer id) {

        return shippingcarskuMapper.getShippingcarsku(id);
    }

}
